You are here: Scripting examples > Creating a backup or snapshot of the target by inserting a task command during replication

Creating a backup or snapshot of the target by inserting a task command during replication

The following script stops the services on the source, pauses the script to allow the source time to write the remaining application data to disk, inserts a Double-Take Availability task command into the Double-Take Availability replication process, and then restarts the services.

REM     Stop the services on the source so that data changes are stopped.

net stop "Service Name 1"

net stop "Service Name 2"

net stop "Service Name 3"

net stop "Service Name 4"

REM     Pause the source (for a specified number of seconds) to allow time

REM     for the application data to be written to disk. The sleep command is

REM     available from the Windows Resource Kit.

sleep 120

REM     At this point the source application is stable (service is stopped

REM     and data is written). Now, initiate your Double-Take Availability

REM     task command, for example to trigger a snapshot or backup. The

REM     process you want to run on the target must be contained in the batch

REM     file specified in the queuetask command. That batch file must be

REM     stored on the target so that it can be executed on the target.

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl $TheSource = "alpha"

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl $TheTarget = "beta"

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl $TheUserName = "administrator"

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl $ThePassword = "password"

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl $TheDomain = "domain.com"

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl login $TheSource $TheUserName $ThePassword $TheDomainName

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl login $TheTarget $TheUserName $ThePassword $TheDomainName

C:\Program Files\Vision Solutions\Double-Take for Linux\dtcl queuetask backup to $TheTarget onexecute=Backup.bat timeout=forever

REM      Now that the task command has been inserted inline with

REM     Double-Take Availability replication, the services

REM     can be restarted. New changes to the data will fall inline behind

REM     the task command just inserted.

net start "Service Name 1"

net start "Service Name 2"

net start "Service Name 3"

net start "Service Name 4"